package com.ywu.data.source.standard.api;

import com.ywu.common.result.CommonResult;
import com.ywu.data.source.standard.dto.YwuDataTableDto;
import com.ywu.data.source.standard.service.YwuDataTableService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName YwuDataTableApi
 * @Description TODO
 * @Author GroundDemo
 * @Date 2024/10/27 18:47
 * @Version 1.0
 **/
@RestController
@RequestMapping("/ywu/data/source/table")
public class YwuDataTableApi {
    @Autowired
    private YwuDataTableService service;

    /**
    * @Author GroundDemo
    * @Description 创建数据表
    * @Date 16:48 2024/10/28
    * @Param [ywuDataTableDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/create.data.table.info")
    public CommonResult<Object> createTable(@RequestBody YwuDataTableDto ywuDataTableDto) {
        return service.createTable(ywuDataTableDto);
    }

    /**
    * @Author GroundDemo
    * @Description 修改数据表信息
    * @Date 16:57 2024/10/28
    * @Param [ywuDataTableDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/update.data.table.info")
    public CommonResult<Object> updateTable(@RequestBody YwuDataTableDto ywuDataTableDto) {
        return service.updateTable(ywuDataTableDto);
    }

    /**
    * @Author GroundDemo
    * @Description 删除数据表
    * @Date 16:58 2024/10/28
    * @Param [ywuDataTableDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/delete.data.table.info")
    public CommonResult<Object> deleteTable(@RequestBody YwuDataTableDto ywuDataTableDto) {
        return service.deleteTable(ywuDataTableDto);
    }

    /**
    * @Author GroundDemo
    * @Description 分页查询数据表数据
    * @Date 17:01 2024/10/28
    * @Param [ywuDataTableDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/query.data.table.info.page")
    public CommonResult<Object> queryTablePageList(@RequestBody YwuDataTableDto ywuDataTableDto) {
        return service.queryTablePageList(ywuDataTableDto);
    }

    /**
    * @Author GroundDemo
    * @Description 查询数据表下的所有字段
    * @Date 13:43 2024/10/31
    * @Param [ywuDataTableDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/query.data.fields.info")
    public CommonResult<Object> queryFieldsByTable(@RequestBody YwuDataTableDto ywuDataTableDto) {
        return service.queryFieldsByTable(ywuDataTableDto);
    }

}
